Dynomotion

Group: DynoMotion Message: 13169 From: jackgiz@ymail.com Date: 4/20/2016
Subject: Message box
Tom,
I would like to add a message box to my Z Homing program.  Do you have some good examples of the message box being applied?  Also, what are the choices other than MB_YESNO that can be used with message boxes?

Jack

Group: DynoMotion Message: 13171 From: Moray Cuthill Date: 4/20/2016
Subject: Re: Message box
Jack,

there's not really much to message boxes that isn't covered in the MessageBox.c example. As to what options are available, they're in the KMotionDef.h file -

/*
 * MessageBox() Flags thes can be passed to the PC to invoke MessageBoxes
 *              for some applications such as KMotionCNC which monitor upload
 *              status and present message boxes when requested.  See the pc-dsp.h
 *              header for more information
 */
#define MB_OK                       0x00000000L
#define MB_OKCANCEL                 0x00000001L
#define MB_ABORTRETRYIGNORE         0x00000002L
#define MB_YESNOCANCEL              0x00000003L
#define MB_YESNO                    0x00000004L
#define MB_RETRYCANCEL              0x00000005L
#define MB_CANCELTRYCONTINUE        0x00000006L
#define MB_ICONHAND                 0x00000010L
#define MB_ICONQUESTION             0x00000020L
#define MB_ICONEXCLAMATION          0x00000030L
#define MB_ICONASTERISK             0x00000040L
#define MB_APPLMODAL                0x00000000L
#define MB_SYSTEMMODAL              0x00001000L
#define MB_TASKMODAL                0x00002000L
#define MB_NOFOCUS                  0x00008000L
#define MB_SETFOREGROUND            0x00010000L
#define MB_DEFAULT_DESKTOP_ONLY     0x00020000L
#define MB_TOPMOST                  0x00040000L
#define MB_RIGHT                    0x00080000L


If you're looking to enter values, you'll need to use the InputBox function, which has the example file MessageInputBox.c

There are a couple issues you need to be aware of. MessageBoxs and InputBoxes are blocking, so you need to be a little bit smart about when you choose to display them.
Also, you can't use them with anything that requires KMotionCNC to wait (i.e. Exec, Wait option), as you end up with a race condition, where KMotionCNC will stop responding because it's waiting for the code in the KFlop to complete, while the KFlop is waiting for a response from KMotionCNC.

Moray

On Wed, Apr 20, 2016 at 3:18 PM, jackgiz@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Tom,
I would like to add a message box to my Z Homing program.  Do you have some good examples of the message box being applied?  Also, what are the choices other than MB_YESNO that can be used with message boxes?

Jack


Group: DynoMotion Message: 13178 From: Jack Date: 4/21/2016
Subject: Re: Message box

Thanks Moray!!  That’s just what I needed.  The msg box pops up and the code works the way I want.

 

One other question.  I’ve been using a version of the SimpleHomeIndexFunctionTest.c program to Home my single stepper X, Y and Z.  I recently converted my Y to a 2 stepper, master/slave arrangement.  I used the HomeSlaved.c program recommended by Tom and combined it with the previous homing program.  All Axis Home perfectly.  However, I can’t figure out how the zero the Y DRO.  If I use the Zero(2); command it zeros the DRO and the Y axis.  In the original Homing program I used:  DoPCFloat (PC_COMM_SET_Y,0); but that command doesn’t seem to work in the new code.  I’ve attached a copy of my code.  What am I doing wrong?

 

Jack

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]
Sent: Wednesday, April 20, 2016 1:49 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Message box

 

 

Jack,

 

there's not really much to message boxes that isn't covered in the MessageBox.c example. As to what options are available, they're in the KMotionDef.h file -

 

/*
 * MessageBox() Flags thes can be passed to the PC to invoke MessageBoxes
 *              for some applications such as KMotionCNC which monitor upload
 *              status and present message boxes when requested.  See the pc-dsp.h
 *              header for more information
 */
#define MB_OK                       0x00000000L
#define MB_OKCANCEL                 0x00000001L
#define MB_ABORTRETRYIGNORE         0x00000002L
#define MB_YESNOCANCEL              0x00000003L
#define MB_YESNO                    0x00000004L
#define MB_RETRYCANCEL              0x00000005L
#define MB_CANCELTRYCONTINUE        0x00000006L
#define MB_ICONHAND                 0x00000010L
#define MB_ICONQUESTION             0x00000020L
#define MB_ICONEXCLAMATION          0x00000030L
#define MB_ICONASTERISK             0x00000040L
#define MB_APPLMODAL                0x00000000L
#define MB_SYSTEMMODAL              0x00001000L
#define MB_TASKMODAL                0x00002000L
#define MB_NOFOCUS                  0x00008000L
#define MB_SETFOREGROUND            0x00010000L
#define MB_DEFAULT_DESKTOP_ONLY     0x00020000L
#define MB_TOPMOST                  0x00040000L
#define MB_RIGHT                    0x00080000L

 

 

If you're looking to enter values, you'll need to use the InputBox function, which has the example file MessageInputBox.c

 

There are a couple issues you need to be aware of. MessageBoxs and InputBoxes are blocking, so you need to be a little bit smart about when you choose to display them.

Also, you can't use them with anything that requires KMotionCNC to wait (i.e. Exec, Wait option), as you end up with a race condition, where KMotionCNC will stop responding because it's waiting for the code in the KFlop to complete, while the KFlop is waiting for a response from KMotionCNC.

 

Moray

 

On Wed, Apr 20, 2016 at 3:18 PM, jackgiz@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:

 

Tom,

I would like to add a message box to my Z Homing program.  Do you have some good examples of the message box being applied?  Also, what are the choices other than MB_YESNO that can be used with message boxes?

Jack

 


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7539 / Virus Database: 4545/12057 - Release Date: 04/18/16

  @@attachment@@
Group: DynoMotion Message: 13196 From: jb10425 Date: 4/23/2016
Subject: Re: Message box
Hi Jack,

A suggestion from someone who knows a little about the C language and not much about the KMotion libraries:

 Before you called "DoPCFloat()", you did couple of "MoveAtVel()" calls. Don't you need to wait until they complete before proceeding?

For example from  HomeSaved.c:

MoveAtVel(X0_AXIS,X0_DIST,speed);  // move inside the limits a small amount
MoveAtVel(X1_AXIS,X1_DIST,speed);  // different distances can be used to square the axis

while (!CheckDone(X0_AXIS) || !CheckDone(X1_AXIS))  ;  // wait till done

I'm not sure this will solve the problem with "DoPCFloat()", but it might help.

John

Group: DynoMotion Message: 13197 From: Jack Date: 4/23/2016
Subject: Re: Message box

Good point.  I’ll give it a try.  Thanks.

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]
Sent: Saturday, April 23, 2016 4:19 PM
To: DynoMotion@yahoogroups.com
Subject: RE: [DynoMotGood point.  I’LL GIVE IT A TRY.ion] Message box

 

 

Hi Jack,

 

A suggestion from someone who knows a little about the C language and not much about the KMotion libraries:

 

 Before you called "DoPCFloat()", you did couple of "MoveAtVel()" calls. Don't you need to wait until they complete before proceeding?

 

For example from  HomeSaved.c:

 

            MoveAtVel(X0_AXIS,X0_DIST,speed);  // move inside the limits a small amount

            MoveAtVel(X1_AXIS,X1_DIST,speed);  // different distances can be used to square the axis

 

            while (!CheckDone(X0_AXIS) || !CheckDone(X1_AXIS))  ;  // wait till done

 

I'm not sure this will solve the problem with "DoPCFloat()", but it might help.

 

John

 


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7539 / Virus Database: 4545/12057 - Release Date: 04/18/16

Group: DynoMotion Message: 13198 From: Jack Date: 4/25/2016
Subject: Re: Message box

John,

That was the problem.  Adding the wait statement fixed the problem.  Thanks again.

 

Jack

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]
Sent: Saturday, April 23, 2016 4:19 PM
To: DynoMotion@yahoogroups.com
Subject: RE: [DynoMotion] Message box

 

 

Hi Jack,

 

A suggestion from someone who knows a little about the C language and not much about the KMotion libraries:

 

 Before you called "DoPCFloat()", you did couple of "MoveAtVel()" calls. Don't you need to wait until they complete before proceeding?

 

For example from  HomeSaved.c:

 

            MoveAtVel(X0_AXIS,X0_DIST,speed);  // move inside the limits a small amount

            MoveAtVel(X1_AXIS,X1_DIST,speed);  // different distances can be used to square the axis

 

            while (!CheckDone(X0_AXIS) || !CheckDone(X1_AXIS))  ;  // wait till done

 

I'm not sure this will solve the problem with "DoPCFloat()", but it might help.

 

John

 


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7539 / Virus Database: 4545/12057 - Release Date: 04/18/16